package cn.xclink.common.test.activiti.db;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;

/**
 * 
 * <p>
 * Title: CreateDb
 * </p>
 * <p>
 * Description: 创建数据库
 * </p>
 * <p>
 * Company: www.itcast.com
 * </p>
 * 
 * @author 传智.燕青
 * @date 2014-12-20上午11:13:36
 * @version 1.0
 */
public class CreateDb {

	public static void main(String[] args) {


		//1. 创建进程引擎配置文件对象
		ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
		//2. 设置jdbc数据
		processEngineConfiguration.setJdbcDriver("com.mysql.jdbc.Driver");
		processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/oa?useUnicode=true&characterEncoding=utf-8");
		processEngineConfiguration.setJdbcUsername("root");
		processEngineConfiguration.setJdbcPassword("root");
		/*
		 * 3. 设置策略
		 * public static final String DB_SCHEMA_UPDATE_FALSE = "false"; 这个设置将不会自动建表
		 * public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop"; 先删除表再建表
		 * public static final String DB_SCHEMA_UPDATE_TRUE = "true"; 自动建表
		 */
		processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
		// 4. 获取工作流的核心对象
		ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
		System.out.println(processEngine);


	}
}
